import { Injectable } from '@angular/core';
import { USER_AUTH } from '@app/store/dict';
import { HttpCacheService } from '@core/net/http-cache.service';

@Injectable({
	providedIn: 'root'
})
export class AuthService {

	constructor(
		private httpCacheService: HttpCacheService
	) { }
	saveAuth(auth) {
		this.httpCacheService.saveSessionCache(USER_AUTH, JSON.stringify(auth));

	}
	getAuth() {
		const menu = this.httpCacheService.getSessionCache(USER_AUTH);
		if (menu) {
			return JSON.parse(menu);
		}
		return [];
	}
}
